home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…stman Always Clicks Twice / ADC Developer CD (1993-01) (''The Postman Always Clicks Twice'')_iso / Dev.CD 199301.iso / Development Platforms / LISP Related / LISP Goodies / AV Parser / Sample Grammars / 02 Simple Grammar.Lisp < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.9 KB  |  40 lines  |  [TEXT/CCL2]

  1. ;;; 02 Simple Grammar.Lisp
  2. ;;;
  3. ;;; A grammar that generates one string, viz. "Uther sleeps".
  4. ;;; Based on Shieber's example in Chapter, Section 3, pp. 21-22.
  5. ;;;
  6. ;;; The parser ignores anything following a semi-colon to the end of a line,
  7. ;;; so anything following a semi-colon is a comment to you, dear reader!
  8. ;;;
  9. ;;; Read this grammar into the parser by choosing "Eval Buffer" from the
  10. ;;; "Eval" menu.  Then enter "(p uther sleeps)" in the Listener (and press
  11. ;;; Return) to parse the utterance "Uther sleeps".  You should see a
  12. ;;; Tree Window displaying a parse tree, and an Avm Window displaying the
  13. ;;; the features associated with the top node in that tree.
  14.  
  15. #[  
  16.  
  17. category-prefix = cat.      ; Put all category values under attribute cat.
  18. value-prefix = head.        ; Put all values under the attribute head
  19.  
  20. start-category := cat(**) = s.   ; We use ** here, since * = head(**) 
  21.  
  22.  
  23. ; AV Parser notation                                 Shieber's notation
  24. ; ------------------                                 ------------------
  25.  
  26. s --> np vp :                                     ;  s --> np vp
  27.   *0 = *2,                                        ;     <s head> = <vp head>
  28.   subject(*0) = *1.                               ;     <s head subject> = <np head>
  29.  
  30. uther np:                                         ; Word uther:  <cat> = np
  31.   number(agreement(*)) = singular,                ;     <head agreement number> = singular
  32.   person(agreement(*)) = third.                   ;     <head agreement person> = third
  33.  
  34. sleeps vp:                                        ; Word sleeps:  <cat> = vp
  35.   form(*) = finite,                               ;     <head form> = finite
  36.   number(agreement(subject(*))) = singular,       ;     <head subject agreement number> = singular
  37.   person(agreement(subject(*))) = third.          ;     <head subject agreement person> = third
  38.   
  39. #]   ; end of grammar.
  40.